<template>
  <header class="header">
    <h1>{{title}}</h1>
    <input class="new-todo" placeholder="请输入您将要做的事情" autofocus @keydown.enter="add">
  </header>
</template>

<script>
import { toRef, ref, reactive } from 'vue'
// import bus from '@/utils/bus.js'
export default {
  props: {
    title: String
  },
  methods: {
    add(e) {
      if (e.keyCode == 13) {
        this.$emit('add', e.target.value)
      }
      e.target.value = ''
    }
  }
  // setup(props, { attrs, slots, emit, expose }) {
  //   const x = ref(props.title)
  //   console.log(x)
  //   // console.log(attrs)
  //   // console.log(slots)
  //   // console.log(emit)
  //   // console.log(expose)
  //   return {}
  // }
}
</script>

<style lang='less' scoped>
</style>